{% extends "base.html" %}

{% block content %}

    
    {% if success %}
    
    <div class="alert alert-success">
        <strong>Úspech!</strong> Účet vytvorený. <strong>Boli ste automaticky prihlásení.</strong>
    </div>
    <center>
        <a href="{% url main_page %}"><button class="btn btn-primary btn-large btn-info">Prejsť na hlavnú stránku</button></a>
    </center>
    
    {% else %}
    <form action="." method="post" class="well">{% csrf_token %}
        
        <fieldset>

            <legend>Vytvoriť účet</legend>
                        
            <div class="control-group {% if form.username.errors %}error{% endif %}">
                <label for="id_username" class="control-label">Meno:</label>
                <div class="controls">
                    {{ form.username }}
                    <span class="help-inline">{{ form.username.errors }}</span>
                </div>
                <p><small>Meno musí obsahovať len <b>malé písmena</b> alebo <b>číslice</b> a nesmie obsahovať medzery.<br>Počet znakov musí byť medzi 6 a 30.</small></p>
            </div>

            <div class="control-group {% if form.password1.errors %}error{% endif %}">
                <label for="id_password1" class="control-label">Heslo:</label>
                <div class="controls">
                    {{ form.password1 }}
                    <span class="help-inline">{{ form.password1.errors }}</span>
                </div>
            </div>

            <div class="control-group {% if form.password2.errors %}error{% endif %}">
                <label for="id_password2" class="control-label">Heslo (znova):</label>
                <div class="controls">
                    {{ form.password2 }}
                    <span class="help-inline">{{ form.password2.errors }}</span>
                </div>
            </div>  
            
            <div class="control-group {% if form.captcha.errors %}error{% endif %}">
                <label for="id_captcha" class="control-label">Vyplňte:</label>
                <div class="controls">
                    {{ form.captcha }}
                </div>
                <span class="help-inline">{{ form.captcha.errors }}</span>
            </div>

            <div class="form-actions">
                <input type="submit" value="Vytvoriť účet" class="btn btn-primary btn-large"/>
            </div>

        </fieldset>       

    </form>
    {% endif %}

{% endblock %}
